<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="adminTemplate.xhtml">

    <ui:define name="contentAdmin">
        <h1>Edit/Remove Users</h1>
        <h:form>
        <h:messages showDetail="true"/>
             <h:dataTable binding="#{editUsers.dataTable}" var="user" value="#{userList.users}"
                     rowClasses="row1, row2" headerClass="tableHeader">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="ID"/>
                </f:facet>
                <h:outputText value="#{user.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Fname"/>
                </f:facet>
                <h:outputText value="#{user.firstName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Lname"/>
                </f:facet>
                <h:outputText value="#{user.lastName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Login"/>
                </f:facet>
                <h:outputText value="#{user.login}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Pass"/>
                </f:facet>
                <h:outputText value="#{user.password}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Descr"/>
                </f:facet>
                <h:outputText value="#{user.description}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="CrDate"/>
                </f:facet>
                <h:outputText value="#{user.created}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="VDate"/>
                </f:facet>
                <h:outputText value="#{user.validity}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Enabled"/>
                </f:facet>
                <h:outputText value="#{user.enabled}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Group"/>
                </f:facet>
                <h:outputText value="#{user.group.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Edit"/>
                </f:facet>
                <h:commandLink value="Edit" action="#{editUsers.edit}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Delete"/>
                </f:facet>
                <h:commandLink value="Delete" action="#{editUsers.delete}">
                    <p:confirmDialog yesLabel="Delete" noLabel="Cancel"
                                     message="Really delete the user?" header="Confirm deletion"
                                     severity="warn" />
                </h:commandLink>
            </h:column>

        </h:dataTable>
        </h:form>
        </ui:define>

</ui:composition>